package com.example.springboot_demo01.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.springboot_demo01.dao.StudentDao;
import com.example.springboot_demo01.dao.TradeDao;
import com.example.springboot_demo01.entity.Student;
import com.example.springboot_demo01.entity.Trade;
import com.example.springboot_demo01.query.StudentQuery;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TradeService {
    @Resource
    TradeDao tradeDao;

    public Trade getById(int id){
        return tradeDao.selectById(id);
    }

    //根据订单编号 获得订单信息
    public Trade getByTradeNo(String tradeNo){
        QueryWrapper<Trade> wrapper = new QueryWrapper<>();
        wrapper.eq("trade_no",tradeNo);

        Trade  trade  = tradeDao.selectOne(wrapper);

        return trade;
    }

    //定义修改订单信息的方法
    public  int update(Trade trade){
        return tradeDao.updateById(trade);
    }
}
